import { Component } from 'react'
import { Provider } from 'mobx-react'
import { observer } from 'mobx-react'

import mainStore from './store/mainStore'
import 'taro-ui/dist/style/index.scss' // 全局引入一次即可
import { getAreas } from './utils/area';
import './api';

import './app.less'

@observer
class App extends Component {
  componentDidMount () {
    mainStore.init()
    getAreas({ hasEmpty: false })
  }

  componentDidShow () {}

  componentDidHide () {}

  componentDidCatchError () {}

  // this.props.children 就是要渲染的页面
  render () {
    return (
      <Provider store={mainStore}>
        {this.props.children}
      </Provider>
    )
  }
}

export default App
